package Z006ClassAndObject.CO005This;

public class Hero {
    String name;
    float hp;
    float armor;
    int moveSpeed;

    public void showAddressInMemory(){
        System.out.println("打印this看到的虚拟地址：" + this);
    }

    public static void main(String[] args) {
        Hero garen = new Hero();
        garen.name = "盖伦";
        System.out.println("打印对象看到的虚拟地址：" + garen);
        garen.showAddressInMemory();

        Hero teemo = new Hero();
        teemo.name = "提莫";
        System.out.println("打印对象看到的虚拟地址：" + teemo);
        teemo.showAddressInMemory();

    }
}

class Hero1{
    String name;
    float hp;
    float armor;
    int moveSpeed;

    public void setName(String name){
        name = name;
    }

    public void setName2(String heroName){
        name = heroName;
    }

    public void setName3(String name){
        this.name = name;
    }

    public static void main(String[] args) {
        Hero1 h = new Hero1();
        h.setName("teemo");
        System.out.println(h.name);

        h.setName2("teemo");
        System.out.println(h.name);

        h.setName3("teemo");
        System.out.println(h.name);
    }
}

class Hero2{
    String name;
    float hp;
    float armor;
    int moveSpeed;

    public Hero2(String name){
        System.out.println("一个参数的构造函数");
        this.name = name;
    }

    public Hero2(String name,float hp){
        this(name);
        System.out.println("两个参数的构造方法");
        this.hp = hp;
    }

    public static void main(String[] args) {
        Hero2 teemo = new Hero2("提莫",383);
        System.out.println(teemo.name);
    }

    /**
     * 参考练习-构造方法 设计一个构造方法,但是参数名称不太一样，分别是
     * String name
     * float hp
     * float armor
     * int moveSpeed
     *
     * 不仅如此，在这个构造方法中，调用这个构造方法
     *
     * public Hero(String name,float hp)
     */
}